@model TimeManager.Domain.Entities.Project

@* This partial view defines form fields that will appear when creating and editing entities *@

<div class="editor-label">
    @Html.LabelFor(model => model.Name)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.Name)
    @Html.ValidationMessageFor(model => model.Name)
</div>

<div class="editor-label">
    @Html.LabelFor(model => model.Description)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.Description)
    @Html.ValidationMessageFor(model => model.Description)
</div>

<div class="editor-label">
    Category
</div>
<div class="editor-field">
    @Html.DropDownListFor(model => model.CategoryId, ((IEnumerable<TimeManager.Domain.Entities.Category>)ViewBag.PossibleCategories).Select(option => new SelectListItem {
        Text = (option == null ? "None" : option.Name), 
        Value = option.CategoryId.ToString(),
        Selected = (Model != null) && (option.CategoryId == Model.CategoryId)
    }), "Choose...")
    @Html.ActionLink("Create new Cateogry", "Create", "Categories")
    @Html.ValidationMessageFor(model => model.CategoryId)
</div>
